package com.qst.rongxiaotong.service.Impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qst.rongxiaotong.mapper.ExpertMapper;
import com.qst.rongxiaotong.pojo.Expert;
import com.qst.rongxiaotong.service.ExpertService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ExpertServiceImpl implements ExpertService {
    @Autowired
    ExpertMapper expertMapper;

    private Integer pageSize = 30;

    //查询专家
    @Override
    public PageInfo<Expert> findPage(Integer pageNum) {
        PageHelper.startPage(pageNum,pageSize);
        List<Expert> experts = expertMapper.selectAllExpert();
        PageInfo<Expert> expertPageInfo = new PageInfo<>(experts);
        return expertPageInfo;
    }

    //条件查询专家
    @Override
    public PageInfo<Expert> findPageByKeys(String keys, Integer pageNum) {
        PageHelper.startPage(pageNum,pageSize);
        List<Expert> experts = expertMapper.selectAllByKeys(keys);
        PageInfo<Expert> expertPageInfo = new PageInfo<>(experts);
        return expertPageInfo;
    }
}
